# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

set(distribution_DIR ${CMAKE_SOURCE_DIR}/libs)

find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )

add_library(
    avcodec-lib
    SHARED
    IMPORTED)
set_target_properties( avcodec-lib
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/${ANDROID_ABI}/libavcodec.soavcodec-56.so)

add_library( avdevice-lib
             SHARED
             IMPORTED)

set_target_properties( avdevice-lib
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/${ANDROID_ABI}/libavdevice.soavdevice-56.so)

add_library(
            avfilter-lib
            SHARED
            IMPORTED)
set_target_properties( avfilter-lib
                      PROPERTIES IMPORTED_LOCATION
                      ${distribution_DIR}/${ANDROID_ABI}/libavfilter.soavfilter-5.so)

add_library(
            avformat-lib
            SHARED
            IMPORTED)

set_target_properties( avformat-lib
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/${ANDROID_ABI}/libavformat.soavformat-56.so)
add_library(
            avutil-lib
            SHARED
            IMPORTED)
set_target_properties(
                      avutil-lib
                      PROPERTIES IMPORTED_LOCATION
                      ${distribution_DIR}/${ANDROID_ABI}/libavutil.soavutil-54.so)
add_library(
             postproc-lib
             SHARED
             IMPORTED)
set_target_properties(
                      postproc-lib
                      PROPERTIES IMPORTED_LOCATION
                      ${distribution_DIR}/${ANDROID_ABI}/libpostproc.sopostproc-53.so)
add_library(
            swresample-lib
            SHARED
            IMPORTED)
set_target_properties(
                      swresample-lib
                      PROPERTIES IMPORTED_LOCATION
                      ${distribution_DIR}/${ANDROID_ABI}/libswresample.soswresample-1.so)
add_library(
            swscale-lib
            SHARED
            IMPORTED)

set_target_properties(
            swscale-lib
            PROPERTIES IMPORTED_LOCATION
            ${distribution_DIR}/${ANDROID_ABI}/libswscale.soswscale-3.so
            )





add_library(playController
            SHARED
            src/main/cpp/playController.cpp
            )


include_directories(src/main/cpp/include)

target_link_libraries( # Specifies the target library.
                       playController
                       avcodec-lib
                       avdevice-lib
                       avfilter-lib
                       avformat-lib
                       avutil-lib
                       postproc-lib
                       swresample-lib
                       swscale-lib
                       ${log-lib} )
